﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ConsolidationTool.Common.Entities;
using System.Collections.Generic;
using ConsolidationTool.Common;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using ConsolidationTool.WebParts.ControlTemplates;

using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;

namespace ConsolidationTool.WebParts.Layouts.CReport.Brochure
{
    public partial class P14SR : LayoutsPageBase
    {
        List<Group> regionGroup = new List<Group>();
        List<Group> subRegionGroup = new List<Group>();
        List<Group> entityGroup = new List<Group>();
        public CommonEntitySelector TopSelector { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            TopSelector = (commonEntitySelector as CommonEntitySelector);
            //TopSelector.EntitySelectorChanged += new CommonEntitySelector.EntitySelectorChangeHandler(TopSelector_EntitySelectorChanged);

            if (!IsPostBack)
            {
                InitBaseInfo();
            }
        }

        void InitBaseInfo()
        {
            // lbCompanyName.Text = Constants.Company_Name;
            TopSelector.yearTextBox.Text = Common.BusinessService.GetConfiguration(Constants.Flash_Input_Year);
            TopSelector.monthTextBox.Text = Common.BusinessService.GetConfiguration(Constants.Flash_Input_Month);

        }

        protected void GenerateReport_Click(object sender, EventArgs e)
        {
            
            //邦定current月数据
            BindLastMonth(TopSelector.drpEntity.SelectedValue, TopSelector.yearTextBox.Text, TopSelector.monthTextBox.Text);

        }

        protected void ExportReport_Click(object sender, EventArgs e)
        {
            P6PL Label01 = null;
            Label01 = new P6PL();
            Label01.row01 = Label01_Date1.Text;
            Label01.row02 = Label01_Date2.Text;
            Label01.row03 = Label01_Date3.Text;
            Label01.row04 = Label01_Date4.Text;
            Label01.row05 = Label01_Date5.Text;
            Label01.row06 = Label01_Date6.Text;
            Label01.row07 = Label01_Date7.Text;
            Label01.row08 = Label01_Date8.Text;
            Label01.row09 = Label01_Date9.Text;
            Label01.row10 = Label01_Date10.Text;
            Label01.row11 = Label01_Date11.Text;
            Label01.row12 = Label01_Date12.Text;
            Label01.row13 = Label01_Date13.Text;

            P6PL Graph01 = null;
            Graph01 = new P6PL();
            Graph01.row01 = Graph01_Day1.Text;
            Graph01.row02 = Graph01_Day2.Text;
            Graph01.row03 = Graph01_Day3.Text;
            Graph01.row04 = Graph01_Day4.Text;
            Graph01.row05 = Graph01_Day5.Text;
            Graph01.row06 = Graph01_Day6.Text;
            Graph01.row07 = Graph01_Day7.Text;
            Graph01.row08 = Graph01_Day8.Text;
            Graph01.row09 = Graph01_Day9.Text;
            Graph01.row10 = Graph01_Day10.Text;
            Graph01.row11 = Graph01_Day11.Text;
            Graph01.row12 = Graph01_Day12.Text;
            Graph01.row13 = Graph01_Day13.Text;

            P6PL Graph02 = null;
            Graph02 = new P6PL();
            Graph02.row01 = Graph02_Day1.Text;
            Graph02.row02 = Graph02_Day2.Text;
            Graph02.row03 = Graph02_Day3.Text;
            Graph02.row04 = Graph02_Day4.Text;
            Graph02.row05 = Graph02_Day5.Text;
            Graph02.row06 = Graph02_Day6.Text;
            Graph02.row07 = Graph02_Day7.Text;
            Graph02.row08 = Graph02_Day8.Text;
            Graph02.row09 = Graph02_Day9.Text;
            Graph02.row10 = Graph02_Day10.Text;
            Graph02.row11 = Graph02_Day11.Text;
            Graph02.row12 = Graph02_Day12.Text;
            Graph02.row13 = Graph02_Day13.Text;

            P6PL Graph03 = null;
            Graph03 = new P6PL();
            Graph03.row01 = Graph03_Day1.Text;
            Graph03.row02 = Graph03_Day2.Text;
            Graph03.row03 = Graph03_Day3.Text;
            Graph03.row04 = Graph03_Day4.Text;
            Graph03.row05 = Graph03_Day5.Text;
            Graph03.row06 = Graph03_Day6.Text;
            Graph03.row07 = Graph03_Day7.Text;
            Graph03.row08 = Graph03_Day8.Text;
            Graph03.row09 = Graph03_Day9.Text;
            Graph03.row10 = Graph03_Day10.Text;
            Graph03.row11 = Graph03_Day11.Text;
            Graph03.row12 = Graph03_Day12.Text;
            Graph03.row13 = Graph03_Day13.Text;


            P6PL col01 = null;
            col01 = new P6PL();
            col01.row01 = Label01_Day1.Text;
            col01.row02 = Label02_Day1.Text;
            col01.row03 = Label03_Day1.Text;

            P6PL col02 = null;
            col02 = new P6PL();
            col02.row01 = Label01_Day2.Text;
            col02.row02 = Label02_Day2.Text;
            col02.row03 = Label03_Day2.Text;

            P6PL col03 = null;
            col03 = new P6PL();
            col03.row01 = Label01_Day3.Text;
            col03.row02 = Label02_Day3.Text;
            col03.row03 = Label03_Day3.Text;

            P6PL col04 = null;
            col04 = new P6PL();
            col04.row01 = Label01_Day4.Text;
            col04.row02 = Label02_Day4.Text;
            col04.row03 = Label03_Day4.Text;

            P6PL col05 = null;
            col05 = new P6PL();
            col05.row01 = Label01_Day5.Text;
            col05.row02 = Label02_Day5.Text;
            col05.row03 = Label03_Day5.Text;

            P6PL col06 = null;
            col06 = new P6PL();
            col06.row01 = Label01_Day6.Text;
            col06.row02 = Label02_Day6.Text;
            col06.row03 = Label03_Day6.Text;

            P6PL col07 = null;
            col07 = new P6PL();
            col07.row01 = Label01_Day7.Text;
            col07.row02 = Label02_Day7.Text;
            col07.row03 = Label03_Day7.Text;

            P6PL col08 = null;
            col08 = new P6PL();
            col08.row01 = Label01_Day8.Text;
            col08.row02 = Label02_Day8.Text;
            col08.row03 = Label03_Day8.Text;

            P6PL col09 = null;
            col09 = new P6PL();
            col09.row01 = Label01_Day9.Text;
            col09.row02 = Label02_Day9.Text;
            col09.row03 = Label03_Day9.Text;

            P6PL col10 = null;
            col10 = new P6PL();
            col10.row01 = Label01_Day10.Text;
            col10.row02 = Label02_Day10.Text;
            col10.row03 = Label03_Day10.Text;

            string fileName = TopSelector.yearTextBox.Text + TopSelector.monthTextBox.Text + Constants._Brochure_P14_PRIFIX + TopSelector.drpEntity.SelectedValue + ".xlsx";
            BusinessService.CreateP14Excel(Label01, Graph01, Graph02, Graph03, LabelTitile00.Text, col01, col02, col03, col04, col05, col06, col07, col08, col09, col10, fileName, LabelTons00.Text, LabelDate00.Text);
            SPSite site = new SPSite(SPContext.Current.Site.ID);
            string reportUrl = site.Url + "/" + Constants._EXCEL_Library + "/" + fileName;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", string.Format("<script>window.open('" + reportUrl + "');</script>"));

        }

        [Serializable]
        public class fsentity
        {
            public bool controlrow { get; set; }
            public bool datarow { get; set; }
            public bool insertcontrol { get; set; }
            public bool bold { get; set; }
            public string unit { get; set; }
            public string accountcode { get; set; }
            public string description { get; set; }
            public string Jan { get; set; }
            public string Feb { get; set; }
            public string Mar { get; set; }
            public string Apr { get; set; }
            public string May { get; set; }
            public string Jun { get; set; }
            public string Jul { get; set; }
            public string Aug { get; set; }
            public string Sep { get; set; }
            public string Oct { get; set; }
            public string Nov { get; set; }
            public string Dec { get; set; }
            public int digits { get; set; }
        }
        public class fsentityAc
        {
            public bool controlrow { get; set; }
            public bool datarow { get; set; }
            public bool insertcontrol { get; set; }
            public bool bold { get; set; }
            public string unit { get; set; }
            public string accountcode { get; set; }
            public string description { get; set; }
            public string YTDM_1 { get; set; }
            public string YTD { get; set; }
            public string CM { get; set; }
            public int digits { get; set; }
        }

        void BindLastMonth(string coCd, string year, string month)
        {
            string strCurrency = TopSelector.lbCompanyCurrency.Text;
            string strTonnage = TopSelector.lbCompanyTonnage.Text;

            LabelTitile00.Text = strCurrency;
            LabelTitile01.Text = strCurrency;
            LabelTitile02.Text = strCurrency;

            LabelDate00.Text = "31/12/" + year;

            LabelTons00.Text = strTonnage;
            LabelTons01.Text = strTonnage;

            int y = Convert.ToInt32(year)-1;
            string yearN_1 = Convert.ToString(y);
            int y2 = Convert.ToInt32(year) - 2;
            string yearN_2 = Convert.ToString(y2);

            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);
            int n = m + 1;

            List<String> monthList = new List<String>();
            string year_n_1 = yearN_1.Substring(2);
            for (int i = m; i <= 12; i++)
            {
                string strMonth = i.ToString();

                switch (i.ToString())
                {
                    case "1":
                        monthList.Add("Jan-" + year_n_1);
                        break;
                    case "2":
                        monthList.Add("Feb-" + year_n_1);
                        break;
                    case "3":
                        monthList.Add("Mar-" + year_n_1);
                        break;
                    case "4":
                        monthList.Add("Apr-" + year_n_1);
                        break;
                    case "5":
                        monthList.Add("May-" + year_n_1);
                        break;
                    case "6":
                        monthList.Add("Jun-" + year_n_1);
                        break;
                    case "7":
                        monthList.Add("Jul-" + year_n_1);
                        break;
                    case "8":
                        monthList.Add("Aug-" + year_n_1);
                        break;
                    case "9":
                        monthList.Add("Sep-" + year_n_1);
                        break;
                    case "10":
                        monthList.Add("Oct-" + year_n_1);
                        break;
                    case "11":
                        monthList.Add("Nov-" + year_n_1);
                        break;
                    case "12":
                        monthList.Add("Dec-" + year_n_1);
                        break;
                    default:
                        break;
                }
            }

            string year_title = year.Substring(2);
            for (int i = 1; i <= m; i++)
            {
                string strMonth = i.ToString();

                switch (i.ToString())
                {
                    case "1":
                        monthList.Add("Jan-" + year_title);
                        break;
                    case "2":
                        monthList.Add("Feb-" + year_title);
                        break;
                    case "3":
                        monthList.Add("Mar-" + year_title);
                        break;
                    case "4":
                        monthList.Add("Apr-" + year_title);
                        break;
                    case "5":
                        monthList.Add("May-" + year_title);
                        break;
                    case "6":
                        monthList.Add("Jun-" + year_title);
                        break;
                    case "7":
                        monthList.Add("Jul-" + year_title);
                        break;
                    case "8":
                        monthList.Add("Aug-" + year_title);
                        break;
                    case "9":
                        monthList.Add("Sep-" + year_title);
                        break;
                    case "10":
                        monthList.Add("Oct-" + year_title);
                        break;
                    case "11":
                        monthList.Add("Nov-" + year_title);
                        break;
                    case "12":
                        monthList.Add("Dec-" + year_title);
                        break;
                    default:
                        break;
                }
            }


            Label01_Date1.Text = monthList[0];
            Label01_Date2.Text = monthList[1];
            Label01_Date3.Text = monthList[2];
            Label01_Date4.Text = monthList[3];
            Label01_Date5.Text = monthList[4];
            Label01_Date6.Text = monthList[5];
            Label01_Date7.Text = monthList[6];
            Label01_Date8.Text = monthList[7];
            Label01_Date9.Text = monthList[8];
            Label01_Date10.Text = monthList[9];
            Label01_Date11.Text = monthList[10];
            Label01_Date12.Text = monthList[11];
            Label01_Date13.Text = monthList[12];

            Graph01_Day1.Text = "0";
            Graph01_Day2.Text = "0";
            Graph01_Day3.Text = "0";
            Graph01_Day4.Text = "0";
            Graph01_Day5.Text = "0";
            Graph01_Day6.Text = "0";
            Graph01_Day7.Text = "0";
            Graph01_Day8.Text = "0";
            Graph01_Day9.Text = "0";
            Graph01_Day10.Text = "0";
            Graph01_Day11.Text = "0";
            Graph01_Day12.Text = "0";
            Graph01_Day13.Text = "0";

            Graph02_Day1.Text = "0";
            Graph02_Day2.Text = "0";
            Graph02_Day3.Text = "0";
            Graph02_Day4.Text = "0";
            Graph02_Day5.Text = "0";
            Graph02_Day6.Text = "0";
            Graph02_Day7.Text = "0";
            Graph02_Day8.Text = "0";
            Graph02_Day9.Text = "0";
            Graph02_Day10.Text = "0";
            Graph02_Day11.Text = "0";
            Graph02_Day12.Text = "0";
            Graph02_Day13.Text = "0";

            Graph03_Day1.Text = "";
            Graph03_Day2.Text = "";
            Graph03_Day3.Text = "";
            Graph03_Day4.Text = "";
            Graph03_Day5.Text = "";
            Graph03_Day6.Text = "";
            Graph03_Day7.Text = "";
            Graph03_Day8.Text = "";
            Graph03_Day9.Text = "";
            Graph03_Day10.Text = "";
            Graph03_Day11.Text = "";
            Graph03_Day12.Text = "";
            Graph03_Day13.Text = "";

            int f = 1;
            for (int i = m; i <= 12; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemInvCurr = Common.BusinessService.GetItem(coCd, yearN_1, strMonth, "Inventory");
                if (itemInvCurr != null)
                {
                    switch (f.ToString())
                    {
                        case "1":
                            Graph01_Day1.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "2":
                            Graph01_Day2.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "3":
                            Graph01_Day3.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "4":
                            Graph01_Day4.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "5":
                            Graph01_Day5.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "6":
                            Graph01_Day6.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "7":
                            Graph01_Day7.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "8":
                            Graph01_Day8.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "9":
                            Graph01_Day9.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "10":
                            Graph01_Day10.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "11":
                            Graph01_Day11.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "12":
                            Graph01_Day12.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        default:
                            break;
                    }
                }
                f = f + 1;
            }

            for (int i = 1; i <= m; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemInvCurr = Common.BusinessService.GetItem(coCd, year, strMonth, "Inventory");
                if (itemInvCurr != null)
                {
                    switch (f.ToString())
                    {
                        case "1":
                            Graph01_Day1.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "2":
                            Graph01_Day2.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "3":
                            Graph01_Day3.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "4":
                            Graph01_Day4.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "5":
                            Graph01_Day5.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "6":
                            Graph01_Day6.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "7":
                            Graph01_Day7.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "8":
                            Graph01_Day8.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "9":
                            Graph01_Day9.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "10":
                            Graph01_Day10.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "11":
                            Graph01_Day11.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "12":
                            Graph01_Day12.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        case "13":
                            Graph01_Day13.Text = itemInvCurr["CM_BS02010403-10"].ToString();
                            break;
                        default:
                            break;
                    }
                }
                f = f + 1;
            }

            int g = 1;
            for (int i = n; i <= 12; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemPL = Common.BusinessService.GetItem(coCd, yearN_2, strMonth, "Inventory");
                if (itemPL != null)
                {
                    switch (g.ToString())
                    {
                        case "1":
                            Graph02_Day1.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "2":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "3":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "4":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "5":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "6":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "7":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "8":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "9":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "10":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "11":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "12":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        default:
                            break;
                    }
                }
                g = g + 1;
            }
            for (int i = 1; i <= 12; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemPL = Common.BusinessService.GetItem(coCd, yearN_1, strMonth, "Inventory");
                if (itemPL != null)
                {
                    switch (g.ToString())
                    {
                        case "1":
                            Graph02_Day1.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "2":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "3":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "4":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "5":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "6":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "7":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "8":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "9":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "10":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "11":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "12":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "13":
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "14":
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "15":
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "16":
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "17":
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "18":
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "19":
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "20":
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "21":
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "22":
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "23":
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "24":
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        default:
                            break;
                    }
                }
                g = g + 1;
            }
            for (int i = 1; i <= m; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemPL = Common.BusinessService.GetItem(coCd, year, strMonth, "Inventory");
                if (itemPL != null)
                {
                    switch (g.ToString())
                    {
                        case "1":
                            Graph02_Day1.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "2":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "3":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "4":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "5":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "6":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "7":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "8":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "9":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "10":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "11":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "12":
                            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "13":
                            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = itemPL["CM_BS02010403-10"].ToString();
                            break;
                        case "14":
                            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "15":
                            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "16":
                            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "17":
                            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "18":
                            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "19":
                            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "20":
                            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "21":
                            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "22":
                            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "23":
                            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        case "24":
                            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) + Convert.ToDecimal(itemPL["CM_BS02010403-10"].ToString())).ToString();
                            break;
                        default:
                            break;
                    }
                }
                g = g + 1;
            }

            Graph02_Day1.Text = (Convert.ToDecimal(Graph02_Day1.Text) / 12).ToString("n");
            Graph02_Day2.Text = (Convert.ToDecimal(Graph02_Day2.Text) / 12).ToString("n");
            Graph02_Day3.Text = (Convert.ToDecimal(Graph02_Day3.Text) / 12).ToString("n");
            Graph02_Day4.Text = (Convert.ToDecimal(Graph02_Day4.Text) / 12).ToString("n");
            Graph02_Day5.Text = (Convert.ToDecimal(Graph02_Day5.Text) / 12).ToString("n");
            Graph02_Day6.Text = (Convert.ToDecimal(Graph02_Day6.Text) / 12).ToString("n");
            Graph02_Day7.Text = (Convert.ToDecimal(Graph02_Day7.Text) / 12).ToString("n");
            Graph02_Day8.Text = (Convert.ToDecimal(Graph02_Day8.Text) / 12).ToString("n");
            Graph02_Day9.Text = (Convert.ToDecimal(Graph02_Day9.Text) / 12).ToString("n");
            Graph02_Day10.Text = (Convert.ToDecimal(Graph02_Day10.Text) / 12).ToString("n");
            Graph02_Day11.Text = (Convert.ToDecimal(Graph02_Day11.Text) / 12).ToString("n");
            Graph02_Day12.Text = (Convert.ToDecimal(Graph02_Day12.Text) / 12).ToString("n");
            Graph02_Day13.Text = (Convert.ToDecimal(Graph02_Day13.Text) / 12).ToString("n");

            SPListItem itemBudgetInvN = Common.BusinessService.GetBudgetItem(coCd, year, "Budget_Inventory");
            if (itemBudgetInvN != null)
            {
                string billData = itemBudgetInvN["BillData"].ToString();

                JavaScriptSerializer Serializer = new JavaScriptSerializer();

                List<fsentity> obj = Serializer.Deserialize<List<fsentity>>(billData);

                var objentity = obj as List<fsentity>;

                objentity.ForEach(p =>
                {
                    if (p.accountcode == "BS03010403-10")
                    {
                        switch (month)
                        {
                            case "1":
                                Graph03_Day13.Text = p.Jan.ToString();
                                
                                break;
                            case "2":
                                Graph03_Day13.Text = p.Feb.ToString();
                                
                                break;
                            case "3":
                                Graph03_Day13.Text = p.Mar.ToString();
                                
                                break;
                            case "4":
                                Graph03_Day13.Text = p.Apr.ToString();
                                
                                break;
                            case "5":
                                Graph03_Day13.Text = p.May.ToString();
                                
                                break;
                            case "6":
                                Graph03_Day13.Text = p.Jun.ToString();
                                
                                break;
                            case "7":
                                Graph03_Day13.Text = p.Jul.ToString();
                                
                                break;
                            case "8":
                                Graph03_Day13.Text = p.Aug.ToString();
                                
                                break;
                            case "9":
                                Graph03_Day13.Text = p.Sep.ToString();
                                
                                break;
                            case "10":
                                Graph03_Day13.Text = p.Oct.ToString();
                                
                                break;
                            case "11":
                                Graph03_Day13.Text = p.Nov.ToString();
                                
                                break;
                            case "12":
                                Graph03_Day13.Text = p.Dec.ToString();
                                
                                break;
                            default:
                                break;
                        }
                        
                    }
                });


            }


            SPListItem itemBS = Common.BusinessService.GetItem(coCd, year, month, "Inventory");
            SPListItem itemBSN_1 = Common.BusinessService.GetItem(coCd, yearN_1, month, "Inventory");

            Label01_Day1.Text = "0";
            Label02_Day1.Text = "0";
            Label03_Day1.Text = "0";
            Label01_Day2.Text = "0";
            Label02_Day2.Text = "0";
            Label03_Day2.Text = "0";
            Label01_Day3.Text = "0";
            Label02_Day3.Text = "0";
            Label03_Day3.Text = "0";
            Label01_Day4.Text = "0";
            Label02_Day4.Text = "0";
            Label03_Day4.Text = "0";
            Label01_Day5.Text = "0";
            Label02_Day5.Text = "0";
            Label03_Day5.Text = "0";
            Label01_Day6.Text = "0";
            Label02_Day6.Text = "0";
            Label03_Day6.Text = "0";
            Label01_Day7.Text = "0";
            Label02_Day7.Text = "0";
            Label03_Day7.Text = "0";
            Label01_Day8.Text = "0";
            Label02_Day8.Text = "0";
            Label03_Day8.Text = "0";
            Label01_Day9.Text = "0";
            Label02_Day9.Text = "0";
            Label03_Day9.Text = "0";
            Label01_Day10.Text = "0";
            Label02_Day10.Text = "0";
            Label03_Day10.Text = "0";

            if (itemBSN_1 != null)
            {
                Label01_Day1.Text = itemBSN_1["CM_BS02010404-10"].ToString();
                Label01_Day3.Text = itemBSN_1["CM_BS02010403-10"].ToString();
                Label03_Day3.Text = itemBSN_1["CM_BS02010403-7"].ToString();
            }
            if (itemBS != null)
            {
                Label01_Day2.Text = itemBS["CM_BS02010404-10"].ToString();
                Label01_Day4.Text = itemBS["CM_BS02010403-10"].ToString();
                Label03_Day4.Text = itemBS["CM_BS02010403-7"].ToString();

                Label01_Day9.Text = itemBS["CM_BS02010406-10"].ToString();
                Label01_Day10.Text = itemBS["CM_BS02010407-10"].ToString();
                Label03_Day9.Text = itemBS["CM_BS02010406-7"].ToString();
                Label03_Day10.Text = itemBS["CM_BS02010407-7"].ToString();
            }

            SPListItem itemBudgetBS = Common.BusinessService.GetBudgetItem(coCd, year, "Budget_Inventory");

            if (itemBudgetBS != null)
            {
                string billData = itemBudgetBS["BillData"].ToString();

                JavaScriptSerializer Serializer = new JavaScriptSerializer();

                List<fsentity> obj = Serializer.Deserialize<List<fsentity>>(billData);

                var objentity = obj as List<fsentity>;

                objentity.ForEach(p =>
                {

                    if (p.accountcode == "BS03010404-10")
                    {
                        Label01_Day5.Text = Convert.ToString(Convert.ToDecimal(p.Dec.ToString()));
                    }
                    if (p.accountcode == "BS03010403-10")
                    {
                        Label01_Day6.Text = Convert.ToString(Convert.ToDecimal(p.Dec.ToString()));
                    }
                    if (p.accountcode == "BS03010403-7")
                    {
                        Label03_Day6.Text = Convert.ToString(Convert.ToDecimal(p.Dec.ToString()));
                    }


                });
            }

            string Total1 = "0";
            string Total2 = "0";
            string Total3 = "0";

            for (int i = 1; i <= m; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemInv = Common.BusinessService.GetItem(coCd, year, strMonth, "Inventory");
                if (itemInv != null)
                {
                    Total1 = Convert.ToString(Convert.ToDecimal(Total1) + Convert.ToDecimal(itemInv["CM_BS02010404-10"].ToString()));
                    Total2 = Convert.ToString(Convert.ToDecimal(Total2) + Convert.ToDecimal(itemInv["CM_BS02010403-10"].ToString()));
                    Total3 = Convert.ToString(Convert.ToDecimal(Total3) + Convert.ToDecimal(itemInv["CM_BS02010403-7"].ToString()));
                }
            }
            for (int i = n; i <= 12; i++)
            {
                string strMonth = i.ToString();

                SPListItem itemInv = Common.BusinessService.GetItem(coCd, yearN_1, strMonth, "Inventory");
                if (itemInv != null)
                {
                    Total1 = Convert.ToString(Convert.ToDecimal(Total1) + Convert.ToDecimal(itemInv["CM_BS02010404-10"].ToString()));
                    Total2 = Convert.ToString(Convert.ToDecimal(Total2) + Convert.ToDecimal(itemInv["CM_BS02010403-10"].ToString()));
                    Total3 = Convert.ToString(Convert.ToDecimal(Total3) + Convert.ToDecimal(itemInv["CM_BS02010403-7"].ToString()));
                }
            }
            if (Total1!="0")
            {
                Label01_Day7.Text = (Convert.ToDecimal(Total1) / 12).ToString("n");
            }
            if (Total2 != "0")
            {
                Label01_Day8.Text = (Convert.ToDecimal(Total2) / 12).ToString("n");
            }
            if (Total3 != "0")
            {
                Label03_Day8.Text = (Convert.ToDecimal(Total3) / 12).ToString("n");
            }


        }

    }
}
